/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sampleEntity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author ASUS K43E
 */
@Entity
@Table(name = "Account", catalog = "Lafitte", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Account.findAll", query = "SELECT a FROM Account a"),
    @NamedQuery(name = "Account.findByUsername", query = "SELECT a FROM Account a WHERE a.username = :username"),
    @NamedQuery(name = "Account.findByPassword", query = "SELECT a FROM Account a WHERE a.password = :password"),
    @NamedQuery(name = "Account.findByArole", query = "SELECT a FROM Account a WHERE a.arole = :arole"),
    @NamedQuery(name = "Account.findByFullname", query = "SELECT a FROM Account a WHERE a.fullname = :fullname"),
    @NamedQuery(name = "Account.findByAddress", query = "SELECT a FROM Account a WHERE a.address = :address"),
    @NamedQuery(name = "Account.findByTelephone", query = "SELECT a FROM Account a WHERE a.telephone = :telephone"),
    @NamedQuery(name = "Account.findByEmail", query = "SELECT a FROM Account a WHERE a.email = :email")})
public class Account implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "username", nullable = false, length = 30)
    private String username;
    @Basic(optional = false)
    @Column(name = "password", nullable = false, length = 30)
    private String password;
    @Basic(optional = false)
    @Column(name = "arole", nullable = false)
    private int arole;
    @Basic(optional = false)
    @Column(name = "fullname", nullable = false, length = 50)
    private String fullname;
    @Column(name = "address", length = 150)
    private String address;
    @Column(name = "telephone", length = 20)
    private String telephone;
    @Basic(optional = false)
    @Column(name = "email", nullable = false, length = 50)
    private String email;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "account")
    private Customers customers;

    public Account() {
    }

    public Account(String username) {
        this.username = username;
    }

    public Account(String password, int arole, String fullname, String address, String telephone, String email, Customers customers) {
        this.password = password;
        this.arole = arole;
        this.fullname = fullname;
        this.address = address;
        this.telephone = telephone;
        this.email = email;
        this.customers = customers;
    }

    public Account(String username, String password, int arole, String fullname, String email) {
        this.username = username;
        this.password = password;
        this.arole = arole;
        this.fullname = fullname;
        this.email = email;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getArole() {
        return arole;
    }

    public void setArole(int arole) {
        this.arole = arole;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Customers getCustomers() {
        return customers;
    }

    public void setCustomers(Customers customers) {
        this.customers = customers;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (username != null ? username.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Account)) {
            return false;
        }
        Account other = (Account) object;
        if ((this.username == null && other.username != null) || (this.username != null && !this.username.equals(other.username))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sampleEntity.Account[username=" + username + "]";
    }

}
